﻿using System;
using System.Linq;
using System.Collections.Generic;
using System.Web.Mvc;
using System.Web.Security;
using CTMOES;
using CTMOES.Helper;

namespace CTMOES.Controllers
{
    public class HomeController : Controller
    {
        private readonly CTMDBEntities _db = new CTMDBEntities();

        public ActionResult Index()
        {
            ViewBag.Message = "Welcome to ASP.NET MVC!";

            return View();
        }

        public ActionResult About()
        {
            return View();
        }

        public PartialViewResult Exam()
        {
            List<CTMOES.Paper> paper=DataHelper.GetPaper();
            return PartialView(paper);
        }
        public PartialViewResult History()
        {
            Guid userid = Guid.Parse(Membership.GetUser().ProviderUserKey.ToString());
            List<CTMOES.ExamHistory> history = _db.ExamHistory.Where(p => p.StudentId == userid).ToList();
            return PartialView(history);
        }
    }
}